﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!doctype html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>下订单</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" />
		<script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
		<!-- 引入自定义css文件 style.css -->
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css"/>
		<style>
			body {
				margin-top: 20px;
				margin: 0 auto;
			}
			
			.carousel-inner .item img {
				width: 100%;
				height: 300px;
			}
		</style>
	</head>
	<body>

	<%@ include file="/jsp/header.jsp" %>


		<div class="container">
		
		 <form id="orderForm" method="post" action="${pageContext.request.contextPath}/OrderServlet?method=payOrder">
			<div class="row">

				<div style="margin:0 auto;margin-top:10px;width:950px;">
					<strong>订单详情</strong>
					<table class="table table-bordered">
						<tbody>
							<tr class="warning">
								<th colspan="5">订单编号:${order.oid}</th>
							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>
						<c:forEach items="${order.list}" var="item">	
							<tr class="activ
							e">
								<td width="60" width="40%">
									<input type="hidden" name="id" value="22">
									<img src="${pageContext.request.contextPath}/${item.product.pimage}" width="70" height="60">
								</td>
								<td width="30%">
									<a target="_blank">${item.product.pname}</a>
								</td>
								<td width="20%">
									￥${item.product.shop_price}
								</td>
								<td width="10%">
									${item.quantity}
								</td>
								<td width="15%">
									<span class="subtotal">￥${item.total}</span>
								</td>
							</tr>
						  </c:forEach>
						</tbody>
					</table>
				</div>

				<div style="text-align:right;margin-right:120px;">
					商品金额: <strong style="color:#ff6600;">￥${order.total }元</strong>
				</div>

			</div>

			<div>
				<hr/>
				
					<div class="form-group">
						<label for="username" class="col-sm-1 control-label">地址</label>
						<div class="col-sm-5">
							<input type="text" id="address" name="address" class="form-control" required id="username" placeholder="请输入收货地址">
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword3" class="col-sm-1 control-label">收货人</label>
						<div class="col-sm-5">
							<input type="text" id="name1" name="name" class="form-control" required id="inputPassword3" placeholder="请输收货人">
						</div>
					</div>
					<div class="form-group">
						<label for="confirmpwd" class="col-sm-1 control-label">电话</label>
						<div class="col-sm-5">
							<input type="text" id="telephone" name="telephone" class="form-control" required id="confirmpwd" placeholder="请输入联系方式">
							<input type="hidden" name="oid" value="${order.oid}"/>
						</div>
					</div>
				

				<hr/>

				<c:if test="${empty isPay}">
					<div style="margin-top:5px;margin-left:150px;">
						<p style="text-align:right;margin-right:100px;">
							<a href="javascript:document.getElementById('orderForm').submit();">
								<img src="${pageContext.request.contextPath}/img/finalbutton.gif" width="204" height="51" border="0" />
							</a>
						</p>
						<hr/>
					</div>
				</c:if>

				<c:if test="${not empty isPay}">
					<div style="margin-top:5px;margin-left:150px;">
						<p style="text-align:right;margin-right:100px;color: red;font-size:2em;">
							付款成功！<a href="javascript:location.href=''">
						</a>
						</p>
						<hr/>
                        <%
                            session.setAttribute("isPay",null);
                        %>
					</div>
				</c:if>

			</div>
		  </form>
		</div>

		<%@ include file="/jsp/footer.jsp" %>
		
	</body>
    <script>
        var address=document.getElementById("address");
        var name1=document.getElementById("name1");
        var  tele=document.getElementById("telephone");
        address.value="${order.address}";
        name1.value="${order.name}";
        tele.value="${order.telephone}";

    </script>
</html>